{% if posts %}
    {% for post in posts %}
        <h3 class="text-primary">
            <a href="{{ url_for('.show_post', post_id=post.id) }}">{{ post.title }}</a>
        </h3>
        <p>
            {{ post.body | striptags | truncate }}
            <small><a href="{{ url_for('.show_post', post_id=post.id) }}">{{ _('Read More') }}</a></small>
        </p>
        <small>
            {{ _('Comments') }}: <a href="{{ url_for('.show_post', post_id=post.id) }}#comments">{{ post.comments | length }}</a>&nbsp;&nbsp;
            {{ _('Category') }}: <a href="{{ url_for('.show_category', category_id=post.category.id) }}">{{ post.category.name }}</a>
            <span class="float-right">{{ moment(post.timestamp).format('LL') }}</span>
        </small>
        {% if not loop.last %}
            <hr>
        {% endif %}
    {% endfor %}
{% else %}
    <div class="tip">
        <h5>{{ _('No posts yet.') }}</h5>
        {% if current_user.is_authenticated %}
            <a href="{{ url_for('admin.new_post') }}">{{ _('Write Now') }}</a>
        {% endif %}
    </div>
{% endif %}